package com.example.grpc.food;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.15.0)",
    comments = "Source: foods/food.proto")
public final class FoodGrpc {

  private FoodGrpc() {}

  public static final String SERVICE_NAME = "Food";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.example.grpc.common.vo.Vo.Empty,
      com.example.grpc.food.FoodOuterClass.FoodResponse> getListMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "list",
      requestType = com.example.grpc.common.vo.Vo.Empty.class,
      responseType = com.example.grpc.food.FoodOuterClass.FoodResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<com.example.grpc.common.vo.Vo.Empty,
      com.example.grpc.food.FoodOuterClass.FoodResponse> getListMethod() {
    io.grpc.MethodDescriptor<com.example.grpc.common.vo.Vo.Empty, com.example.grpc.food.FoodOuterClass.FoodResponse> getListMethod;
    if ((getListMethod = FoodGrpc.getListMethod) == null) {
      synchronized (FoodGrpc.class) {
        if ((getListMethod = FoodGrpc.getListMethod) == null) {
          FoodGrpc.getListMethod = getListMethod = 
              io.grpc.MethodDescriptor.<com.example.grpc.common.vo.Vo.Empty, com.example.grpc.food.FoodOuterClass.FoodResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "Food", "list"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.example.grpc.common.vo.Vo.Empty.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.example.grpc.food.FoodOuterClass.FoodResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new FoodMethodDescriptorSupplier("list"))
                  .build();
          }
        }
     }
     return getListMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static FoodStub newStub(io.grpc.Channel channel) {
    return new FoodStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static FoodBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new FoodBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static FoodFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new FoodFutureStub(channel);
  }

  /**
   */
  public static abstract class FoodImplBase implements io.grpc.BindableService {

    /**
     */
    public void list(com.example.grpc.common.vo.Vo.Empty request,
        io.grpc.stub.StreamObserver<com.example.grpc.food.FoodOuterClass.FoodResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getListMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getListMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                com.example.grpc.common.vo.Vo.Empty,
                com.example.grpc.food.FoodOuterClass.FoodResponse>(
                  this, METHODID_LIST)))
          .build();
    }
  }

  /**
   */
  public static final class FoodStub extends io.grpc.stub.AbstractStub<FoodStub> {
    private FoodStub(io.grpc.Channel channel) {
      super(channel);
    }

    private FoodStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected FoodStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new FoodStub(channel, callOptions);
    }

    /**
     */
    public void list(com.example.grpc.common.vo.Vo.Empty request,
        io.grpc.stub.StreamObserver<com.example.grpc.food.FoodOuterClass.FoodResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getListMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class FoodBlockingStub extends io.grpc.stub.AbstractStub<FoodBlockingStub> {
    private FoodBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private FoodBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected FoodBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new FoodBlockingStub(channel, callOptions);
    }

    /**
     */
    public com.example.grpc.food.FoodOuterClass.FoodResponse list(com.example.grpc.common.vo.Vo.Empty request) {
      return blockingUnaryCall(
          getChannel(), getListMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class FoodFutureStub extends io.grpc.stub.AbstractStub<FoodFutureStub> {
    private FoodFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private FoodFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected FoodFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new FoodFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.example.grpc.food.FoodOuterClass.FoodResponse> list(
        com.example.grpc.common.vo.Vo.Empty request) {
      return futureUnaryCall(
          getChannel().newCall(getListMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_LIST = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final FoodImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(FoodImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_LIST:
          serviceImpl.list((com.example.grpc.common.vo.Vo.Empty) request,
              (io.grpc.stub.StreamObserver<com.example.grpc.food.FoodOuterClass.FoodResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class FoodBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    FoodBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.example.grpc.food.FoodOuterClass.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("Food");
    }
  }

  private static final class FoodFileDescriptorSupplier
      extends FoodBaseDescriptorSupplier {
    FoodFileDescriptorSupplier() {}
  }

  private static final class FoodMethodDescriptorSupplier
      extends FoodBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    FoodMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (FoodGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new FoodFileDescriptorSupplier())
              .addMethod(getListMethod())
              .build();
        }
      }
    }
    return result;
  }
}
